package youcaihuaoa.weetop.com.ui.login

import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.blankj.utilcode.util.ColorUtils
import com.blankj.utilcode.util.SpanUtils
import com.blankj.utilcode.util.StringUtils
import com.robot.base.base.activity.GLBaseActivity
import com.robot.base.configs.AppConstants
import com.robot.base.util.ToastUtils
import com.robot.base.util.arouter.ARouterUtil
import me.goldze.mvvmhabit.BR
import youcaihuaoa.weetop.com.R
import youcaihuaoa.weetop.com.databinding.AppActivityLoginBinding
import youcaihuaoa.weetop.com.vm.login.LoginViewModel


/**
 * 验证码登陆页面
 */
@Route(path = AppConstants.Router.Main.A_LOGIN)
class LoginActivity : GLBaseActivity<AppActivityLoginBinding, LoginViewModel>() {

    override fun initContentView(savedInstanceState: Bundle?): Int = R.layout.app_activity_login

    override fun initVariableId(): Int = BR.viewModel

    override fun initComponents() {
        setViewData()
    }

    private fun setViewData() {
        SpanUtils.with(binding.tvPrompt)
            .append(StringUtils.getString(R.string.app_en_tips_7))
            .append(StringUtils.getString(R.string.app_en_tips_8))
            .setClickSpan(ColorUtils.getColor(R.color._57B3FF), false) {
                ToastUtils.showShort("点击了用户服务协议")
            }
            .append(StringUtils.getString(R.string.app_en_tips_10))
            .append(StringUtils.getString(R.string.app_en_tips_9))
            .setClickSpan(ColorUtils.getColor(R.color._57B3FF), false) {
                ToastUtils.showShort("点击了隐私条款")
            }
            .create()

        SpanUtils.with(binding.tvForgetPassword)
            .append("忘记密码？")
            .append("点击找回")
            .setClickSpan(ColorUtils.getColor(R.color._57B3FF), false) {
                ARouterUtil.goToActivity(AppConstants.Router.Main.A_FORGET_PASSWORD)
            }
            .create()
    }


}